package com.gkoudai.open.platform.common;

import com.alibaba.fastjson2.annotation.JSONCreator;
import com.alibaba.fastjson2.annotation.JSONType;
import lombok.AllArgsConstructor;
import lombok.Getter;


public class CategoryCommon {
    @Getter
    @AllArgsConstructor
    public enum AgriculturalCategoryEnum {
        ALL(null),
        PIGLETS("生猪"),
        CORN("玉米"),
        CORNSTARCH("玉米淀粉"),
        CHICKEN_EGGS("鸡蛋"),
        MARSHMALLOWS("棉花"),
        COTTON_YARN("棉纱"),
        SUGAR("白糖"),
        APPLE("苹果"),
        GROUNDNUT("花生"),
        PUMAI("普麦"),
        STRONG_WHEAT("强麦"),
        RED_JUJUBE("红枣"),
        JAPONICA_RICE("粳米"),
        JAPONICA_MAGNAPORTHE("粳稻"),
        LATE_INDICA("晚籼"),
        EARLY_INDICA("早籼");
        private final String category;
    }

    @Getter
    @AllArgsConstructor
    public enum EnergyCategoryEnum {
        ALL(null),
        CRUDE_OIL("原油"),
        LIQUEFIED_PETROLEUM_GAS("液化石油气"),
        LOW_SULPHUR_FUEL_OIL("低硫燃油"),
        ASPHALT("沥青"),
        STEAM_COAL("动力煤");
        private final String category;
    }

    @Getter
    @AllArgsConstructor
    public enum ChemicalCategoryEnum {
        ALL(null),
        METHYL_ALCOHOL("甲醇"),
        ETHYLENE_GLYCOL("乙二醇"),
        CARBAMIDE("尿素"),
        SODA_ASH("纯碱"),
        PTA("PTA"),
        STAPLE_FIBER("短纤"),
        PVC("PVC"),
        POLYSTYRENE("苯乙烯"),
        PLASTICS("塑料"),
        RUBBER("橡胶"),
        NO_20_GLUE("20号胶"),
        GLASS("玻璃");
        private final String category;
    }

    @Getter
    @AllArgsConstructor
    public enum BlackCategoryEnum {
        ALL(null),
        IRON_ORE("铁矿石"),
        HOT_ROLLED_COIL("热轧卷板"),
        THREADED("螺纹"),
        WIRE_ROD("线材"),
        FERROSILICON("硅铁"),
        MANGANESE_SILICON("锰硅"),
        STAINLESS_STEEL("不锈钢");
        private final String category;
    }

    @Getter
    @AllArgsConstructor
    public enum QuoteTypeEnum {
        COMMODITIES("COMMODITIES", "大宗商品"),
        GLOBAL_INDEX("GLOBALINDEX", "全球指数"),
        SHGOODS("SHGOODS", "上海黄金交易所"),
        FOREX("FOREX", "外汇行情"),
        GOODS("GOODS", "商品行情");
        private final String type;
        private final String desc;
    }

    @AllArgsConstructor
    @Getter
    public enum EtfTypeEnum {
        GOLD_ETF("GOLDETF", "黄金ETF"),
        SILVER_ETF("SILVERETF", "白银ETF");
        private final String type;
        private final String desc;

    }

    @JSONType(writeEnumAsJavaBean = true)
    @AllArgsConstructor
    @Getter
    public enum NewsTypeEnum {
        NCL("NCL", "综合快讯(带日历)"),
        PRECIOUS_METALS_INFORMATION("PRECIOUSMETALNEWS", "贵金属资讯"),
        STOCK_INFORMATION("STOCKNEWS", "股票资讯"),
        CRUDE_OIL_INFORMATION("CRUDEOILNEWS", "原油资讯"),
        FUTURES_INFORMATION("FUTURESNEWS", "期货资讯");
        private final String type;
        private final String desc;

        @JSONCreator
        public static NewsTypeEnum fromCode(String type) {
            for (NewsTypeEnum code : NewsTypeEnum.values()) {
                if (code.getType().equals(type)) {
                    return code;
                }
            }
            return null; // 或抛出异常
        }

    }

    @AllArgsConstructor
    @Getter
    public enum FuturesQuoteTypeEnum {
        DLSP("大连商品交易所", "DLSP"),
        SHQH("上海期货交易所", "SHQH"),
        SHNY("上海国际能源交易所", "SHNY"),
        ZZSP("郑州商品交易所", "ZZSP"),
        ZGJRQH("中国金融期货交易所", "ZZQH"),
        GZQH("广州期货交易所", "GZQH");
        private final String desc;
        private final String type;
    }

    @AllArgsConstructor
    @Getter
    public enum DataType {
        DELETE("删除", "delete"),
        UPDATE("改编", "update");
        private String dataType;
        private String desc;
    }

    @AllArgsConstructor
    @Getter
    public enum CalendarTypeEnum {
        EVENT("FNC", "事件"),
        HOLIDAY("WLD", "节假日"),
        ECONOMIC("CLD", "经济数据");
        private String type;
        private String desc;
    }
}
